<template>
  <div class="mainContent">
    <div class="headerTitle">综合监督管理平台-一厂多租</div>
    <!-- 项目选择切换 -->
    <div class="topProjectSelect">
      <div @click="goOthers('space')" class="top1"></div>
      <div @click="goOthers('dust')" class="top1 top2"></div>
      <div @click="goOthers('danger')" class="top1 top3"></div>
      <div @click="goOthers('home')" class="top1 top4"></div>
      <div @click="goOthers('home')" class="top1 bottom1"></div>
      <div @click="goOthers('home')" class="top1 bottom1 bottom2"></div>
      <div @click="goOthers('factory')" class="top1 bottom1 bottom3"></div>
      <div @click="goOthers('home')" class="top1 bottom1 bottom4"></div>
    </div>
    <!-- 左右侧边内容 -->
    <div class="content">
      <!-- 公共统计数据 -->
      <div class="commonStatic aside-left-show">
        <div class="innerTitle">
          <div class="descTitle">公共统计数据</div>
          <div class="detail">查看详情</div>
        </div>
        <div class="company" @click="showCompanyDialog">
          <div class="companyNum">44</div>
          <div class="companyNumR">+0</div>
        </div>
        <div class="signal">
          <div class="signalNum">0</div>
          <div class="signalNumR">+0</div>
        </div>
        <div class="equip">
          <div class="equipNum">0</div>
          <div class="equipNumR">+0</div>
        </div>
        <div class="video">
          <div class="videoNum">0</div>
          <div class="videoNumR">+0</div>
        </div>
      </div>
      <!-- 出租情况 -->
      <div class="L2 aside-left-show">
        <div class="innerTitle">
          <div class="descTitle">出租情况</div>
          <div class="detail">查看详情</div>
        </div>
        <div class="bigNum">
          <div class="factoryNum">65</div>
          <div class="yanzhenNum">65</div>
        </div>
        <div class="smallLeftNum">
          <div class="num1">0</div>
          <div class="num2">65</div>
        </div>
        <div class="smallRightNum">
          <div class="num1">65</div>
          <div class="num2">0</div>
        </div>
      </div>
      <!-- 右侧  流统计 -->
      <div class="R1 aside-right-show">
        <div class="innerTitle">
          <div class="descTitle">流程统计</div>
          <div class="detail">查看详情</div>
        </div>
        <div class="liuchengNum">
          <div class="qiyeNum">44</div>
          <div class="daibanNum">0</div>
          <div class="wanjieNum">0</div>
        </div>
      </div>
      <!-- 企业结构类型 -->
      <div class="R2 aside-right-show">
        <div class="innerTitle">
          <div class="descTitle">企业结构类型</div>
          <div class="detail">查看详情</div>
        </div>

        <div id="R2_echarts"></div>
      </div>
    </div>
    <div class="sheBeiZuo1dialogVisible" v-if="isDialogShow === 'factory'">
      <div class="closeX">
        <img
          src="@/assets/factory/组 39@1x.png"
          alt=""
          @click="closeDialogShow"
        />
      </div>
      <div class="title">已发布厂房招租</div>
      <div class="table">
        <el-table
          :data="tableData"
          style="width: 100%; border: 'none'"
          :header-row-style="{
            backgroundColor: '#053A3B',
            color: '#2FC4B2',
            borderBottom: '1px solid #022627',
            borderRight: '1px solid #022627',
            height: '32px',
          }"
          :header-cell-style="{
            backgroundColor: '#053A3B',
            color: '#2FC4B2',
            borderBottom: '1px solid #022627',
            height: '32px',
            padding: '7px 0',
          }"
          :row-style="{
            backgroundColor: '#053A3B',
            color: '#2FC4B2',
            borderBottom: '1px solid #022627',
            height: '32px',
          }"
          :cell-style="{
            borderBottom: '1px solid #022627',
            height: '32px',
            padding: '7px 0',
          }"
        >
          <el-table-column
            prop="title"
            header-align="center"
            label="标题"
            width="180"
            :show-overflow-tooltip="true"
          >
          </el-table-column>
          <el-table-column
            prop="address"
            label="详细地址"
            header-align="center"
            width="220"
            :show-overflow-tooltip="true"
          >
          </el-table-column>
          <el-table-column
            prop="factoryTypeName"
            label="厂房类型"
            header-align="center"
            width="120"
            :show-overflow-tooltip="true"
          >
          </el-table-column>
          <el-table-column
            prop="rentableArea"
            label="可租面积(m²)"
            header-align="center"
            width="120"
            :show-overflow-tooltip="true"
          >
          </el-table-column>
          <el-table-column
            prop="industry"
            label="适合行业"
            header-align="center"
            width="180"
            :show-overflow-tooltip="true"
          >
          </el-table-column>
          <el-table-column
            header-align="center"
            prop="rentalStatusName"
            label="是否出租"
            width="80"
          >
            <template slot-scope="scope">
              <span v-if="scope.row.rentalStatusName === '可租'">{{
                scope.row.rentalStatusName
              }}</span>
              <span v-else style="color: #de0202">{{
                scope.row.rentalStatusName
              }}</span>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div class="footerPage">
        <el-pagination
          :current-page="params.page"
          :page-size="10"
          background
          layout="prev, pager, next"
          :total="totalItemCount"
          @current-change="currentPage"
        />
      </div>
    </div>
    <div class="areaSelect"></div>
    <div class="footerNav"></div>
  </div>
</template>

<script>
import { getFactoryLease } from '@/api/factory'
export default {
  name: 'factoryVue',
  props: {},
  components: {},
  data() {
    return {
      isDialogShow: '',
      tableData: [],
      totalItemCount: null,
      params: {
        pageNum: 1,
        pageSize: 10,
      },
    }
  },
  methods: {
    goOthers(path) {
      if (path !== this.$route.path.substring(1)) {
        this.$router.push(
          `/${path}`,
          () => {},
          () => {}
        )
      } else {
        this.$router.push('/home')
      }
    },
    showCompanyDialog() {
      this.getFactoryLease(this.params)
      this.isDialogShow = 'factory'
    },
    closeDialogShow() {
      this.isDialogShow = ''
      this.params = {
        pageNum: 1,
        pageSize: 10,
      }
    },
    currentPage(pageNum) {
      console.log(pageNum)
      const params = {
        pageNum: pageNum,
        pageSize: this.params.pageSize,
      }
      this.getFactoryLease(params)
    },
    showR2Echarts() {
      var myChart = this.$echarts.init(document.getElementById('R2_echarts'))
      myChart.setOption({
        //   backgroundColor:"#0F285C",
        grid: {
          containLabel: true,
          top: 30,
          right: 15,
          bottom: 15,
          left: 15,
        },
        tooltip: {
          trigger: 'axis',
          axisPointer: {
            type: 'shadow',
          },
          formatter: (params) => {
            // console.log(params)
            const { name, data } = params[0]
            return `
            <span style="font-size: 14px;font-family: Source Han Sans CN-Medium;font-weight: 500;color: #FFFFFF;margin-bottom:12px;">${name}</span>
            <span style="font-size: 14px;font-family: Source Han Sans CN-Medium;font-weight: 500;color: #FFFFFF;margin-bottom:4px;">：${data} 家</span>
         `
          },
          extraCssText:
            'opacity: 0.8;background-color:#050F1B;padding:16px;box-shadow: 1px 6px 15px 1px rgba(0,0,0,0.13);border-radius: 4px;filter: blur(undefinedpx);border:none;',
        },
        xAxis: {
          // 类目轴
          type: 'category',
          data: [
            '电子信息',
            '装备制造',
            '纺织服装',
            '智能家居',
            '先进能源',
            '生物医药',
          ],
          axisTick: {
            show: false, //隐藏X轴刻度
          },
          axisLine: {
            lineStyle: {
              color: '#117e87',
            },
          },
          axisLabel: {
            show: true,
            // interval: 'auto',
            // rotate: 30,
            color: '#fff',
            fontSize: 12,
            fontFamily: 'Source Han Sans CN-Regular',
            interval: 0,
            formatter: function (value) {
              return value.split('').join('\n')
            },

            // formatter: function (value) {
            //   // 使用换行符\n来控制标签的换行显示
            //   return value.replace(/(.{2,3})./g, '$1\n')
            // }
          },
        },
        yAxis: {
          type: 'value',
          name: '',
          nameTextStyle: {
            color: '#fff',
            fontSize: 14,
            fontFamily: 'Source Han Sans CN-Regular',
            align: 'left',
            verticalAlign: 'center',
          },
          axisLabel: {
            color: '#fff',
            textStyle: {
              fontSize: 14,
            },
          },
          axisLine: {
            show: false,
            lineStyle: {
              color: 'rgba(223, 223, 223, 1)',
            },
          },
          axisTick: {
            show: false,
          },
          splitLine: {
            lineStyle: {
              color: '#117e87',
              type: 'dashed',
            },
          },
        },
        series: [
          {
            type: 'bar',
            barWidth: '20%',
            showBackground: true,
            backgroundStyle: {
              color: 'transparent',
            },
            itemStyle: {
              color: {
                type: 'linear',
                x: 0, // 渐变的起始 x 坐标
                y: 0, // 渐变的起始 y 坐标（柱子的底部）
                x2: 0, // 渐变的结束 x 坐标
                y2: 1, // 渐变的结束 y 坐标（柱子的顶部）
                colorStops: [
                  { offset: 1, color: '#154e60' },
                  { offset: 0, color: '#2aa49d' },
                ],
              },
            },
            data: [20, 27, 11, 10, 6, 6],
          },
        ],
      })
    },
    async getFactoryLease(params) {
      const res = await getFactoryLease({
        pageNum: params.pageNum,
        pageSize: params.pageSize,
      })
      console.log(res)
      this.tableData = res.data.list
      this.totalItemCount = res.data.total
    },
  },
  created() {},
  mounted() {
    this.showR2Echarts(this.params)
  },
  watch: {},
  computed: {},
  filters: {},
}
</script>

<style scoped lang="scss">
.mainContent {
  width: 1920px;
  height: 1080px;
  position: relative;
  background-image: url('@/assets/common/WechatIMG2357.png');
  background-size: cover;
  background-repeat: no-repeat;
}

.content {
  .commonStatic {
    background-image: url('@/assets/home/组 48059@1x.png');
    position: absolute;
    background-size: cover;
    background-repeat: no-repeat;
    left: 11px;
    top: 72px;
    width: 420px;
    height: 282px;
    position: relative;
    .innerTitle {
      color: #fff;
      background-image: url('@/assets/home/组 48060@1x.png');
      background-size: cover;
      background-repeat: no-repeat;
      width: 405px;
      box-sizing: border-box;
      height: 36px;
      font-size: 20px;
      font-weight: bold;
      position: relative;
      .descTitle {
        position: absolute;
        left: 15px;
        top: 7px;
      }
      .detail {
        color: #5de1d4;
        font-size: 12px;
        font-weight: bold;
        position: absolute;
        top: 5px;
        left: 327px;
        cursor: pointer;
      }
    }

    .company {
      background-image: url('@/assets/home/组 231@1x.png');
      background-size: cover;
      background-repeat: no-repeat;
      width: 180px;
      height: 92px;
      position: absolute;
      left: 20px;
      top: 58px;
      cursor: pointer;
      .companyNum {
        position: absolute;
        left: 74px;
        top: 15px;
        color: #fff;
        font-size: 28px;
        font-weight: bold;
      }
      .companyNumR {
        position: absolute;
        top: 2px;
        right: 6px;
        color: #103f3a;
        font-size: 12px;
        font-weight: bold;
      }
    }
    .signal {
      background-image: url('@/assets/home/组 48062@1x.png');
      background-size: cover;
      background-repeat: no-repeat;
      width: 180px;
      height: 92px;
      position: absolute;
      left: 220px;
      top: 58px;
      .signalNum {
        position: absolute;
        left: 74px;
        top: 15px;
        color: #fff;
        font-size: 28px;
        font-weight: bold;
      }
      .signalNumR {
        position: absolute;
        top: 2px;
        right: 6px;
        color: #103f3a;
        font-size: 12px;
        font-weight: bold;
      }
    }
    .equip {
      background-image: url('@/assets/home/组 229@1x (1).png');
      background-size: cover;
      box-sizing: border-box;
      background-repeat: no-repeat;
      background-position: center;
      width: 180px;
      height: 93px;
      position: absolute;
      left: 20px;
      top: 166px;
      .equipNum {
        position: absolute;
        left: 74px;
        top: 15px;
        color: #fff;
        font-size: 28px;
        font-weight: bold;
      }
      .equipNumR {
        position: absolute;
        top: 2px;
        right: 6px;
        color: #103f3a;
        font-size: 12px;
        font-weight: bold;
      }
    }

    .video {
      background-image: url('@/assets/home/组 222@1x (1).png');
      background-size: cover;
      box-sizing: border-box;
      background-repeat: no-repeat;
      background-position: center;
      width: 180px;
      height: 93px;
      position: absolute;
      left: 220px;
      top: 166px;
      .videoNum {
        position: absolute;
        left: 74px;
        top: 15px;
        color: #fff;
        font-size: 28px;
        font-weight: bold;
      }
      .videoNumR {
        position: absolute;
        top: 2px;
        right: 6px;
        color: #103f3a;
        font-size: 12px;
        font-weight: bold;
      }
    }
  }

  .L2 {
    background-image: url('@/assets/factory/L2.png');
    position: absolute;
    background-size: cover;
    background-repeat: no-repeat;
    width: 420px;
    height: 672px;
    top: 83px;
    left: 11px;
    position: relative;
    .innerTitle {
      color: #fff;
      font-size: 20px;
      font-weight: bold;
      position: relative;
      .descTitle {
        position: absolute;
        left: 35px;
        top: 7px;
      }
      .detail {
        color: #5de1d4;
        font-size: 12px;
        font-weight: bold;
        position: absolute;
        top: 5px;
        left: 327px;
        cursor: pointer;
      }
    }
    .bigNum {
      font-family: Source Han Sans;
      font-size: 32px;
      font-weight: bold;
      line-height: normal;
      text-align: right;
      font-feature-settings: 'kern' on;
      color: #ffffff;
      .factoryNum {
        position: absolute;
        top: 125px;
        left: 10px;
        width: 210px;
        text-align: center;
      }
      .yanzhenNum {
        position: absolute;
        top: 125px;
        left: 200px;
        width: 210px;
        text-align: center;
      }
    }
    .smallLeftNum {
      font-family: Alimama ShuHeiTi;
      font-size: 14px;
      font-weight: bold;
      line-height: 14px;
      letter-spacing: 0em;
      font-variation-settings: 'opsz' auto;
      color: #33e8cc;
      .num1 {
        width: 83px;
        text-align: center;
        position: absolute;
        top: 429px;
        left: 102px;
      }
      .num2 {
        width: 83px;
        text-align: center;
        position: absolute;
        top: 523px;
        left: 102px;
      }
    }
    .smallRightNum {
      font-family: Alimama ShuHeiTi;
      font-size: 14px;
      font-weight: bold;
      line-height: 14px;
      letter-spacing: 0em;
      font-variation-settings: 'opsz' auto;
      color: #01c2fb;
      .num1 {
        width: 83px;
        text-align: center;
        position: absolute;
        top: 429px;
        left: 303px;
      }
      .num2 {
        width: 83px;
        text-align: center;
        position: absolute;
        top: 523px;
        left: 303px;
      }
    }
  }

  .R1 {
    background-image: url('@/assets/factory/R1.png');
    position: absolute;
    background-size: cover;
    background-repeat: no-repeat;
    width: 420px;
    height: 507px;
    top: 72px;
    right: 11px;
    .innerTitle {
      color: #fff;
      font-size: 20px;
      font-weight: bold;
      position: relative;
      .descTitle {
        position: absolute;
        left: 35px;
        top: 7px;
      }
      .detail {
        color: #5de1d4;
        font-size: 12px;
        font-weight: bold;
        position: absolute;
        top: 5px;
        left: 327px;
        cursor: pointer;
      }
    }
    .liuchengNum {
      font-family: Source Han Sans;
      font-size: 32px;
      font-weight: bold;
      line-height: normal;
      text-align: right;
      letter-spacing: 0em;
      font-feature-settings: 'kern' on;
      color: #ffffff;
      .qiyeNum {
        position: absolute;
        top: 272px;
        left: 23px;
        width: 130px;
        text-align: center;
      }
      .daibanNum {
        position: absolute;
        top: 272px;
        left: 155px;
        width: 130px;
        text-align: center;
      }
      .wanjieNum {
        position: absolute;
        top: 272px;
        left: 282px;
        width: 130px;
        text-align: center;
      }
    }
  }

  .R2 {
    background-image: url('@/assets/factory/R2.png');
    position: absolute;
    background-size: cover;
    background-repeat: no-repeat;
    width: 420px;
    height: 447px;
    top: 589px;
    right: 11px;
    .innerTitle {
      color: #fff;
      font-size: 20px;
      font-weight: bold;
      position: relative;
      .descTitle {
        position: absolute;
        left: 17px;
        top: 7px;
      }
      .detail {
        color: #5de1d4;
        font-size: 12px;
        font-weight: bold;
        position: absolute;
        top: 5px;
        left: 327px;
        cursor: pointer;
      }
    }
    #R2_echarts {
      margin-top: 80px;
      width: 420px;
      height: 330px;
    }
  }
}

.headerTitle {
  background-image: url('@/assets/common/HEAD@1x (1).png');
  background-size: cover;
  background-repeat: no-repeat;
  position: relative;
  box-sizing: border-box;
  width: 1920px;
  height: 102px;
  text-align: center;
  padding-top: 9px;
  font-size: 40px;
  color: #fff;
  font-weight: bold;
  position: absolute;
  left: 0;
  top: 0;
}
.footerNav {
  background-image: url('@/assets/common/组 48054@1x.png');
  background-size: cover;
  background-repeat: no-repeat;
  position: relative;
  width: 1920px;
  height: 48px;
  position: absolute;
  left: 0;
  bottom: 0;
}
.areaSelect {
  background-image: url('@/assets/common/Buttom_Nav@1x.png');
  background-size: cover;
  background-repeat: no-repeat;
  position: relative;
  width: 684px;
  height: 30px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 52px;
}
.topProjectSelect {
  .top1 {
    width: 195px;
    height: 96px;
    position: absolute;
    top: 105px;
    left: 558px;
    background-image: url('@/assets/common/组 48064@1x.png');
    background-size: cover;
    background-repeat: no-repeat;
  }
  .top2 {
    left: 766px;
    background-image: url('@/assets/common/组 48065@1x.png');
  }
  .top3 {
    left: 973px;
    background-image: url('@/assets/common/组 48066@1x.png');
  }
  .top4 {
    left: 1190px;
    background-image: url('@/assets/common/组 48067@1x.png');
  }
  .bottom1 {
    top: 232px;
    background-image: url('@/assets/common/组 48068@1x.png');
  }
  .bottom2 {
    left: 766px;
    background-image: url('@/assets/common/组 48069@1x.png');
  }
  .bottom3 {
    left: 973px;
    background-image: url('@/assets/common/组 216@1x.png');
  }
  .bottom4 {
    left: 1190px;
    background-image: url('@/assets/common/组 48070@1x.png');
  }
}
.sheBeiZuo1dialogVisible {
  width: 960px;
  height: 580px;
  background-image: url('@/assets/factory/矩形 201@1x.png');
  background-repeat: no-repeat;
  background-size: cover;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 350px;
  .closeX {
    display: flex;
    justify-content: right;
    padding: 4px;
    img {
      cursor: pointer;
    }
  }
  .title {
    font-size: 20px;
    font-weight: bold;
    color: #fff;
    padding-left: 30px;
    margin-bottom: 8px;
    .subTitle {
      color: #9e9e9e;
      font-size: 12px;
    }
  }
  .table {
    padding: 0 30px;
    .el-table .warning-row {
      background-color: transparent;
      background: #022627 !important;
    }
    .el-table::before {
      display: none;
    }
  }
  .footerPage {
    width: 100%;
    text-align: center;
    margin: 20px auto 0;

    ::v-deep .el-pagination.is-background .el-pager li:not(.disabled).active {
      background-color: #62c1b2 !important; // 进行修改选中项背景和字体
      color: #fff;
    }
  }
  .picBox {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    padding: 0 44px;
    margin-bottom: -31px;
    box-sizing: border-box;
    img {
      width: 429px;
      height: 214px;
      margin-bottom: 31px;
    }
  }
  ::v-deep .el-table__empty-block {
    background-color: #053a3b !important;
    border: none;
    .el-table__empty-text {
      color: #fff;
    }
  }
}
</style>
